package com.uplooking.service;

import com.uplooking.dao.DBUtil;
import org.apache.commons.dbutils.QueryRunner;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Date;

public class AddArtical {
    public Integer getAddArtical(String username,String title,String artical) throws SQLException {
        DataSource c3P0ConnctionPool = DBUtil.getC3P0ConnctionPool();
        QueryRunner queryRunner = new QueryRunner(c3P0ConnctionPool);
        Date date = new Date();
        Object[] objects ={username,title,artical,date};
        int update = queryRunner.update("insert into artical values(null,?,?,?,null,null,?,500,500)", objects);
        return update;

    }
}
